<!--
 * @Description: mine页面
 * @Author: Kerwin
 * @Date: 2024-08-27 10:34:41
 * @LastEditTime: 2025-04-14 15:05:13
 * @LastEditors:  Please set LastEditors
-->

<template>
    <view class="mine">
        <view class="cellBox">
            <view class="cellItem">
                <view class="cell-left">
                    <view class="icon">
                        <u-image :src="getImgFullPath(userStore?.userInfo?.avatar)" mode="widthFix" width="100"
                            height="100" border-radius="10"></u-image>
                    </view>
                    <view class="con">
                        <view class="name avatar">{{ userStore?.userInfo?.nickname }}</view>
                        <view class="other"> {{ userStore?.userInfo?.phone }}</view>
                    </view>
                </view>
                <view class="cell-right" @click="toProfile">
                    <u-icon :name="ic_qrcode" size="30rpx" color="#999" style="margin-right: 20rpx;"></u-icon>
                    <u-icon name="arrow-right" size="26" color="#B0B0B0"></u-icon>
                </view>
            </view>
        </view>
        <view class="cellBox">
            <view class="cellItem" v-for="(item, index) in features[0]" :key="index">
                <view class="cell-left">
                    <view class="icon">
                        <u-icon :name="item.icon" size="46"></u-icon>
                    </view>
                    <view class="con">
                        <view class="name"> {{ item.name }}</view>
                    </view>
                </view>
                <view class="cell-right">
                    <u-icon name="arrow-right" size="26" color="#B0B0B0"></u-icon>
                </view>
            </view>
        </view>
        <view class="cellBox">
            <view class="cellItem" v-for="(item, index) in features[1]" :key="index">
                <view class="cell-left">
                    <view class="icon">
                        <u-icon :name="item.icon" size="40"></u-icon>
                    </view>
                    <view class="con">
                        <view class="name"> {{ item.name }}</view>
                    </view>
                </view>
                <view class="cell-right">
                    <u-icon name="arrow-right" size="26" color="#B0B0B0"></u-icon>
                </view>
            </view>
        </view>
        <view class="cellBox">
            <view class="cellItem" @click="handleSetting(index)" v-for="(item, index) in features[2]" :key="index">
                <view class="cell-left">
                    <view class="icon">
                        <u-icon :name="item.icon" size="46"></u-icon>
                    </view>
                    <view class="con">
                        <view class="name"> {{ item.name }}</view>
                    </view>
                </view>
                <view class="cell-right">
                    <u-icon name="arrow-right" size="26" color="#B0B0B0"></u-icon>
                </view>
            </view>
        </view>
    </view>
</template>

<script lang="ts" setup>
import { useUserStore } from '@/store';
import { getImgFullPath } from '@/utils';
import { ref } from 'vue';

import ic_qrcode from '@/static/ic_qrcode.png'
import icon_setting from '../../static/img/t04.png'
import icon_home from '../../static/img/my.png'

import { route } from '@/utils/common';

const userStore = useUserStore();
const features = ref([
    [

    ],
    [

    ],
    [
        {
            name: '设置',
            icon: icon_setting,
            path: ''
        },
        {
            name: '回到黑银',
            icon: icon_home,
            path: ''
        }
    ]
])
const toProfile = () => {
    route({
        url: '/packageD/pages/profile/index',
    })
}


//点击设置
const handleSetting = (index: number) => {
    console.log(index, 222222);
    switch (index) {
        case 1:
            uni.switchTab({
                url: '/pages/my/index'
            })
            break;

        default:
            break;
    }


}

</script>

<style scoped lang="scss">
.mine {
    .cellBox {
        margin-bottom: 20rpx;
        background: #fff;

        .cellItem {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 30rpx 20rpx;
            border-bottom: 1px solid #F0F0F0;

            .cell-left {
                display: flex;
                align-items: center;

                .icon {
                    margin-right: 26rpx;
                    display: flex;
                    align-items: center;
                }

                .con {
                    flex: 1;

                    .name {
                        font-size: 30rpx;
                        color: #000;

                        &.avatar {
                            font-size: 32rpx;
                            font-weight: 600;
                            margin-bottom: 20rpx;
                        }
                    }

                    .other {
                        font-size: 24rpx;
                        color: #999;
                    }
                }
            }

            .cell-right {
                display: flex;
                align-items: center;

                u-icon {
                    width: 20rpx;
                    height: 20rpx;
                    font-size: 20rpx;
                    color: #B0B0B0;
                }
            }
        }
    }
}
</style>